<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style type="text/css">

/* tooltip */
#tooltip{
  position:absolute;
  border:1px solid #ccc;
  background:#333;
  padding:2px;
  display:none;
  color:#fff;
}
</style>
</head>
<body style="padding:10px;">
  <div class="tplay-body-div">
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">商会申请入会管理</li>
        <li><a href="{:url('admin/chamber/publish')}" class="a_menu">新增申请</a></li>
      </ul>
    </div> 
      <form class="layui-form serch" action="{:url('admin/chamber/index')}" method="post">
        <div class="layui-form-item" style="float: left;">
          <div class="layui-input-inline">
            <input type="text" name="keywords" lay-verify="title" autocomplete="off" placeholder="请输入关键词" class="layui-input layui-btn-sm">
          </div>

          <div class="layui-input-inline">
            <div class="layui-inline">
                <select name="status" lay-search="">
                  <option value="">状态</option>
                  <option value="0">待审核</option>
                  <option value="1">已审核</option>
                </select>
            </div>
          </div>
          <div class="layui-input-inline">
            <div class="layui-inline">
                <select name="admin_id" lay-search="">
                  <option value="">创建人</option>
                  {volist name="$info.admin" id="vo"}
                  <option value="{$vo.id}">{$vo.nickname}</option>
                  {/volist}
                </select>
            </div>
          </div>
          <div class="layui-input-inline">
            <div class="layui-inline">
              <div class="layui-input-inline">
                <input type="text" class="layui-input" id="create_time" placeholder="创建时间" name="create_time">
              </div>
            </div>
          </div>
          <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">立即提交</button>
        </div>
      </form> 
    <table class="layui-table" lay-size="sm">
      <colgroup>
        <col width="20">
        <col width="50">
        <col width="50">
        <col width="85">
        <col width="50">
        <col width="50">
        <col width="50">
        <col width="50">
        <col width="50">
        <col width="50">
        <col width="50">
        <col width="50">
        <col width="15">
        <col width="50">
        <col width="50">
        <col width="60">
        <col width="50">
      </colgroup>
      <thead>
        <tr>
          <th>ID</th>
          <th>姓名</th>
          <th>公司地址</th>
          <th>手机号</th>
          <th>邮箱</th>
          <th>网址</th>
          <th>籍贯</th>
          <th>座机</th>
          <th>缩略图</th>
          <th>导航栏</th>
          <th>公司名称</th>
          <th>创建时间</th>
          <th>性别</th>
          <th>修改时间</th>
          <th>职务</th>
          <th>审核</th>
          <th>操作</th>
        </tr> 
      </thead>
      <tbody>
        {volist name="chamber" id="vo"}
        <tr>
          <td>{$vo.id}</td>
          <td>{$vo.title}</td>
          <td>{$vo.company}</td>
          <td>{$vo.phone}</td>
          <td>{$vo.mail}</td>
          <td>{$vo.url}</td>
          <td>{$vo.place}</td>
          <td>{$vo.telephone}</td>
          <td><a href="{$vo.thumb|geturl}" class="tooltip"><img src="{$vo.thumb|geturl}" width="20" height="20"></a></td>
          <td>{$vo.cate.title}</td>
          <td>{$vo.company_name}</td>>
          <td>{$vo.create_time}</td>
          <td>{$vo.sex}</td>
          <td>{$vo.update_time}</td>
          <td>{$vo.duty}</td>
          <td>{if condition="$vo.status eq 0"}<span class="layui-badge layui-bg-orange">待审核</span>
            {elseif condition="$vo.status eq 1"}<span class="layui-badge">已审核</span>{else /}<span class="layui-badge layui-bg-gray">已拒绝</span>{/if}</td>
          <td class="operation-menu">
            <div class="layui-btn-group">
              <a class="layui-btn layui-btn-xs open layui-btn-primary" data-id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="fa {if condition="$vo.status eq 1"}fa-toggle-on{else/}fa-toggle-off{/if}"></i></a>
              <a href="{:url('admin/chamber/publish',['id'=>$vo.id])}" class="layui-btn layui-btn-xs a_menu layui-btn-primary" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
              <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-primary delete" id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
            </div>
          </td>
        </tr>
        {/volist}
      </tbody>
    </table>
            
    {include file="public/foot"}

    <script type="text/javascript">
      layui.use('layer', function(){
        var layer = layui.layer;
        $('.open').click(function(){
          var id = $(this).attr('data-id');
          layer.msg('文件审核',{
            time:20000
            ,btn: ['通过', '拒绝', '再想想']
            ,yes: function(index, layero){
              $.ajax({
                url:"{:url('admin/chamber/audit')}"
                ,type:'post'
                ,data:{id:id,status:'1'}
                ,success:function(res){
                  layer.msg(res.msg);
                  if(res.code == 1){
                    setTimeout(function(){
                      location.href = res.url;
                    },1500)
                  }
                }
              })
            }
            ,btn2: function(index, layero){
              $.ajax({
                url:"{:url('admin/chamber/audit')}"
                ,type:'post'
                ,data:{id:id,status:'-1'}
                ,success:function(res){
                  layer.msg(res.msg);
                  if(res.code == 1){
                    setTimeout(function(){
                      location.href = res.url;
                    },1500)
                  }
                }
              })
            }
          })
        })
      });
    </script>

    <script type="text/javascript">

    $('.delete').click(function(){
      var id = $(this).attr('id');
      layer.confirm('确定要删除?', function(index) {
        $.ajax({
          url:"{:url('admin/chamber/delete')}",
          data:{id:id},
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
              setTimeout(function(){
                location.href = res.url;
              },1500)
            }
          }
        })
      })
    })
    </script>
    <script type="text/javascript">


    // $('.status').click(function(){
    //   var val = $(this).attr('data-val');
    //   var id = $(this).attr('data-id');
    //   var i = $(this).find('i');
    //   var the = $(this);
    //   if(val == 1){
    //     var status = 0;
    //   } else {
    //     var status = 1;
    //   }
    //   $.ajax({
    //     type:"post",
    //     url:"{:url('admin/media/status')}",
    //     data:{status:status,id:id},
    //     success:function(res){
    //
    //       if(res.code == 1) {
    //         tostatus();
    //       } else {
    //         layer.msg(res.msg);
    //       }
    //     }
    //   })

      function tostatus(){
        if(val == 1){
          i.attr("class","fa fa-toggle-off");
          the.attr('data-val',0);
        } else {
          i.attr("class","fa fa-toggle-on");
          the.attr('data-val',1);
        }
      }
    })
    </script>
  </div>
</body>
</html>
